import Vue from 'vue'
import Router from 'vue-router'
import Layout from '../components/layout/Layout'
Vue.use(Router)
//录音文件查看
export const constantRouterMap = [
    {path: '',name: '',component: Layout,redirect: '/workPlace'},
    { path: '/', redirect: 'login',name:'登录页面',component:()=>import('../components/work/login/index.vue'),meta: {showHN: false}},
    /*** 拨打电话界面*/
    { path: '/call', component: ()=>import('../components/work/call/callIndex.vue'),name: 'call',meta: { title: '拨打电话界面', icon: 'fa fa-home' } },
    /*** 我的资料*/
    { path: '/my', component: ()=>import('../components/work/my/myIndex.vue'),name: 'my',meta: { title: '我的资料', icon: 'fa' } },
    /*** 登录界面*/
    { path: '/login', component: ()=>import('../components/work/login/index.vue'),name: 'login',meta: {showHN: false} },
    /*** 锁屏*/
    {path: '/lock', hidden: true,name: 'lock',component: () => import('@/views/common/lock'),meta: { title: '锁屏', icon: 'fa' }},
    {
        path: '',
        name: 'workPlace',
        component: Layout,
        meta: { title: '首页', icon: 'fa fa-home' },
        children: [
            /*** 欢迎页面管理*/
            {path: 'workPlace'
                ,component: ()=>import('../components/work/customerManage/workPlace/index.vue')
                ,name: 'workPlace'
                ,meta: { title: '首页', icon: 'fa fa-home' },
            },
        ]
    },
    {
        path: '',
        name: 'basicInformation',
        component: Layout,
        meta: { title: '基本配置信息', icon: 'fa fa-wpforms' },
        children: [
            { path: 'basicInformation/systemdict'
                ,component: ()=>import('../components/work/basicInformation/systemdict/systemdictIndex.vue')
                ,name: 'systemdict'
                ,meta: {auth: true,title: '系统字典', icon: 'fa fa-calculator'}},//系统字典
            { path: 'basicInformation/cpxx'
                , component: ()=>import('../components/work/basicInformation/cpxx/cpxxIndex.vue')
                , name: 'cpxx'
                ,meta: {auth: true,title: '产品信息', icon: 'fa fa-product-hunt'}},//产品信息
            { path: 'basicInformation/ygxx'
                , component: ()=>import('../components/work/basicInformation/ygxx/ygxxIndex.vue')
                , name: 'ygxx'
                ,meta: {auth: true,title: '员工信息', icon: 'fa fa-male'}},//员工信息
            { path: 'basicInformation/tjConfig'
                , component: ()=>import('../components/work/basicInformation/tjConfig/tjIndex.vue')
                , name: 'tjConfig'
                ,meta: {auth: true,title: '统计配置', icon: 'fa fa-male'}},//统计配置
        ]
    },
    {
        path: '',
        name: 'messageCenter',
        component: Layout,
        meta: { title: '消息中心', icon: 'fa fa-wpforms' },
        children: [
            { path: 'messageCenter/notify'
                ,component: ()=>import('../components/work/messageCenter/notify/notifyIndex.vue')
                ,name: 'notify'
                ,meta: {auth: true,title: '通知公告', icon: 'fa fa-calculator'}},//通知公告
            { path: 'messageCenter/todayAddIntentAccount'
                ,component: ()=>import('../components/work/messageCenter/todayAddIntentAccount/todayAddIntentAccountIndex.vue')
                ,name: 'todayAddIntentAccount'
                ,meta: {auth: true,title: '今日新增意向客户', icon: 'fa fa-calculator'}},//客户消息
        ]
    },
    {
        path: '',
        name: 'qxManagerSysnic',
        component: Layout,
        meta: { title: '同步前后台权限', icon: 'fa fa-wpforms' },
        children: [
            {path: 'qxManager/sysnic'
                ,component: ()=>import('../components/work/qxManage/sysnic/sysnicIndex.vue')
                ,name: 'sysnic'
                ,meta: {auth: true,title: '同步前后台权限', icon: 'fa fa-male'}},
        ]
    },
    {
        path: '',
        name: 'hotCenter',
        component: Layout,
        meta: { title: '热线中心', icon: 'fa fa-phone-square' },
        children: [
            /*** 热线中心*/
            { path: 'hotCenter/hwzx'
                , component: ()=>import('../components/work/hotCenter/hwzx/hwzxIndex.vue')
                , name: 'hwzx'
                ,meta: {auth: true,title: '话务中心', icon: 'fa fa-mobile'}},//话务中心 有两个子页面，这两个页面通过这种方式加载
            { path: 'hotCenter/zccl'
                , component: ()=>import('../components/work/hotCenter/zccl/zcclIndex.vue')
                , name: 'zccl'
                ,meta: {auth: true,title: '暂存处理', icon: 'fa fa-male'}},//暂存处理
        ]
    },
    {
        path: '',
        name: 'callBack',
        component: Layout,
        meta: { title: '回访中心', icon: 'fa fa-phone-square' },
        children: [
            /*** 回访中心*/
            {path: 'callBack/hfcl'
                ,component: ()=>import('../components/work/callBack/hfcl/hfclIndex.vue')
                ,name: 'hfcl'
                ,meta: {auth: true,title: '回访处理', icon: 'fa fa-male'}},//回访处理
            {path: 'callBack/khfp'
                ,component: ()=>import('../components/work/callBack/khfp/khfpIndex.vue')
                ,name: 'khfp'
                ,meta: {auth: true,title: '客户分配', icon: 'fa fa-male'}},
        ]
    },
    {
        path: '',
        name: '权限管理',
        component: Layout,
        meta: { title: '权限管理', icon: 'fa fa-phone-square' },
        children: [
            /*** 权限管理*/
            {path: 'qxManager/permission'
                ,component: ()=>import('../components/work/qxManage/permission/permissionIndex.vue')
                ,name: 'permission'
                ,meta: {auth: true,title: '部门管理', icon: 'fa fa-male'}},//权限列表
            {path: 'qxManager/role'
                ,component: ()=>import('../components/work/qxManage/role/roleIndex.vue')
                ,name: 'role'
                ,meta: {auth: true,title: '公司管理', icon: 'fa fa-male'}},
            {path: 'qxManager/position'
                ,component: ()=>import('../components/work/qxManage/position/positionIndex.vue')
                ,name: 'position'
                ,meta: {auth: true,title: '职位管理', icon: 'fa fa-male'}},
            {path: 'qxManager/rule'
                ,component: ()=>import('../components/work/qxManage/rule/ruleIndex.vue')
                ,name: 'rule'
                ,meta: {auth: true,title: '规则管理', icon: 'fa fa-male'}},
            {path: 'qxManager/assignment'
                ,component: ()=>import('../components/work/qxManage/assignment/assignmentIndex.vue')
                ,name: 'assignment'
                ,meta: {auth: true,title: '用户列表', icon: 'fa fa-male'}},
            {path: 'qxManager/route'
                ,component: ()=>import('../components/work/qxManage/route/routeIndex.vue')
                ,name: 'route'
                ,meta: {auth: true,title: '后台权限管理', icon: 'fa fa-male'}}
        ]
    },
    {
        path: '',
        name: 'systemConfig',
        component: Layout,
        meta: { title: '系统配置', icon: 'fa fa-phone-square' },
        children: [
            /*** 系统配置*/
            { path: 'yhgl'
                , component: ()=>import('../components/work/systemConfig/yhgl/index.vue')
                , name: 'yhgl'
                ,meta: {auth: true,title: '用户管理', icon: 'fa fa-phone-square'}},
        ]
    },
    {
        path: '',
        name: 'ctiManager',
        component: Layout,
        meta: { title: 'cti管理', icon: 'fa fa-phone-square' },
        children: [
            /***cti管理*/
            { path: 'rdhpz'
                , component: ()=>import('../components/work/ctiManage/rdhpz/rdhpzIndex.vue')
                , name: 'rdhpz'
                ,meta: {auth: true,title: '软电话配置', icon: 'fa fa-male'}},
            { path: 'drgw'
                , component: ()=>import('../components/work/ctiManage/drgw/drgwIndex.vue')
                , name: 'drgw'
                ,meta: {auth: true,title: '导入网关', icon: 'fa fa-male'}},
            { path: 'drzx'
                , component: ()=>import('../components/work/ctiManage/drzx/drzxIndex.vue')
                , name: 'drzx'
                ,meta: {auth: true,title: '导入坐席', icon: 'fa fa-male'}},
            { path: 'fpfs'
                , component: ()=>import('../components/work/ctiManage/fpfs/fpfsIndex.vue')
                , name: 'fpfs'
                ,meta: {auth: true,title: '响铃方式', icon: 'fa fa-male'}},
            { path: 'jnz'
                , component: ()=>import('../components/work/ctiManage/jnz/jnzIndex.vue')
                , name: 'jnz'
                ,meta: {auth: true,title: '技能组', icon: 'fa fa-male'}},
            { path: 'cdr'
                , component: ()=>import('../components/work/ctiManage/cdr/cdrIndex.vue')
                , name: 'cdr'
                ,meta: {auth: true,keepAlive:true,title: '总话单', icon: 'fa fa-male'}},
            { path: 'mycdr'
                , component: ()=>import('../components/work/ctiManage/cdr/cdrIndex.vue')
                , name: 'mycdr'
                ,meta: {auth: true,keepAlive:true,title: '我的话单', icon: 'fa fa-male',type:'myCdr'}},
            { path: 'ivrTu'
                , component: ()=>import('../components/work/ctiManage/ivr/indexTu.vue')
                , name: 'ivrTu'
                ,meta: {auth: true,title: '导入ivr', icon: 'fa fa-male'}},
            { path: 'lywj'
                , component: ()=>import('../components/work/ctiManage/lywj/lywjIndex.vue')
                , name: 'lywj'
                ,meta: {auth: true,title: '录音文件', icon: 'fa fa-male'}},
        ]
    },
    {
        path: '',
        name: 'logsManage',
        component: Layout,
        meta: { title: '日志管理', icon: 'fa fa-phone-square' },
        children: [
            { path: 'mylogs'
                , component: ()=>import('../components/work/mylogs/mylogsIndex.vue')
                , name: 'mylogs'
                ,meta: {auth: true,title: '日志查看', icon: 'fa fa-male'}},
            { path: 'datalogs'
                , component: ()=>import('../components/work/datalogs/datalogsIndex.vue')
                , name: 'datalogs'
                ,meta: {auth: true,title: '数据操作记录', icon: 'fa fa-male'}},
        ]
    },
]
export const constantRouterMap_ = JSON.parse(JSON.stringify(constantRouterMap));//创造一个不是指向同一个地址的变量
export const asyncRouterMap = [
    {
        path: '/permission',
        component: Layout,
        redirect: '/permission/page',
        name: 'permissions',
        alwaysShow: true, // will always show the root menu
        meta: {
            title: 'permission',
            icon: 'lock',
            roles: ['admin', 'editor'] // you can set roles in root nav
        },
        children: [{
            path: 'page',
            component: () => import('@/views/permission/page'),
            name: 'pagePermission',
            meta: {
                title: 'pagePermission',
                roles: ['admin'] // or you can only set roles in sub nav
            }
        }, {
            path: 'directive',
            component: () => import('@/views/permission/directive'),
            name: 'directivePermission',
            meta: {
                title: 'directivePermission'
                // if do not set roles, means: this page does not require permission
            }
        }]
    },
    {
        path: '/error',
        component: Layout,
        redirect: 'noredirect',
        name: 'errorPages',
        meta: {
            title: 'errorPages',
            icon: '404'
        },
        children: [
            { path: '401', component: () => import('@/views/errorPage/401'), name: 'page401', meta: { title: 'page401', noCache: true }},
            { path: '404', component: () => import('@/views/errorPage/404'), name: 'page404', meta: { title: 'page404', noCache: true }}
        ]
    },
    // 错误日志
    {
        path: '/errorLog',
        component: Layout,

        children: [
            {
                path: 'errorLog',
                name: 'errorLog',
                component: () => import('@/views/errorLog/errorLog'),
                meta: { title: 'Errorlog', icon: 'errorLog' }
            }
        ]
    },
    { path: '*', redirect: '/404', hidden: true }]
export default new Router({
    // mode: 'history', //后端支持可开
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRouterMap
});